package cn.wyl.feignclient;

import cn.wyl.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(value = "user-server",fallback=UserFeignFallBack.class )
//FeignClient(value = "user-server",fallbackFactory = UserFeignFallBackFactory.class )
public interface IUserFeignClient {

    @GetMapping("/user/{id}")
    public User get(@PathVariable("id") Long id);

/*
    @EnableFeignClients  发现 @FeignClient --->user-server 服务的名字
    class UserFeignClientProxy impl ...{
        @GetMapping("/user/{id}")
        public User get(@PathVariable("id") Long id){
                url="http://user-server/user/{id}"
               restTemplate.post(url，User.class);
        }
    }
*/
}